<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="Definitions_1" targetNamespace="http://camunda.org/schema/1.0/bpmn">
  <bpmn2:process id="terminateEndEventExample" name="Default Process" isExecutable="true">
    <bpmn2:startEvent id="start">
      <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
    </bpmn2:startEvent>
    <bpmn2:parallelGateway id="ParallelGateway_1">
      <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
      <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
    </bpmn2:parallelGateway>
    <bpmn2:sequenceFlow id="SequenceFlow_2" sourceRef="start" targetRef="ParallelGateway_1"/>
    <bpmn2:userTask id="preNormalEnd" name="check before normal end">
      <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
    </bpmn2:userTask>
    <bpmn2:sequenceFlow id="SequenceFlow_4" sourceRef="ParallelGateway_1" targetRef="preNormalEnd"/>
    <bpmn2:subProcess id="SubProcess_1" name="SubProcess">
      <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
      <bpmn2:multiInstanceLoopCharacteristics id="MultiInstanceLoopCharacteristics_1" isSequential="true">
        <bpmn2:loopCardinality xsi:type="bpmn2:tFormalExpression" id="FormalExpression_1">5</bpmn2:loopCardinality>
      </bpmn2:multiInstanceLoopCharacteristics>
      <bpmn2:serviceTask id="checkTerminate" camunda:class="org.camunda.bpm.engine.test.bpmn.event.end.TerminateEndEventTest$CountDelegate" name="Service Task" implementation="##unspecified">
        <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
      </bpmn2:serviceTask>
      <bpmn2:sequenceFlow id="SequenceFlow_5" sourceRef="checkTerminate" targetRef="ExclusiveGateway_1"/>
      <bpmn2:endEvent id="EndEvent_5">
        <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
      </bpmn2:endEvent>
      <bpmn2:startEvent id="StartEvent_1">
        <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
      </bpmn2:startEvent>
      <bpmn2:sequenceFlow id="SequenceFlow_3" sourceRef="StartEvent_1" targetRef="checkTerminate"/>
      <bpmn2:exclusiveGateway id="ExclusiveGateway_1">
        <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
        <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
      </bpmn2:exclusiveGateway>
      <bpmn2:sequenceFlow id="SequenceFlow_8" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_2">
        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" id="FormalExpression_2">${terminate}</bpmn2:conditionExpression>
      </bpmn2:sequenceFlow>
      <bpmn2:parallelGateway id="ParallelGateway_2">
        <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing>
        <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
      </bpmn2:parallelGateway>
      <bpmn2:endEvent id="EndEvent_1">
        <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
        <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2"/>
      </bpmn2:endEvent>
      <bpmn2:sequenceFlow id="SequenceFlow_15" name="" sourceRef="ParallelGateway_2" targetRef="EndEvent_1"/>
      <bpmn2:userTask id="UserTask_1" name="User Task">
        <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
      </bpmn2:userTask>
      <bpmn2:sequenceFlow id="SequenceFlow_14" sourceRef="UserTask_1" targetRef="EndEvent_2"/>
      <bpmn2:endEvent id="EndEvent_2">
        <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
      </bpmn2:endEvent>
      <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ParallelGateway_2" targetRef="UserTask_1"/>
      <bpmn2:serviceTask id="ServiceTask_1" camunda:class="org.camunda.bpm.engine.test.bpmn.event.end.TerminateEndEventTest$CountDelegate2" name="Service Task" implementation="##unspecified">
        <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
        <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
      </bpmn2:serviceTask>
      <bpmn2:sequenceFlow id="SequenceFlow_10" sourceRef="ExclusiveGateway_1" targetRef="ServiceTask_1">
        <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" id="FormalExpression_3">${!terminate}</bpmn2:conditionExpression>
      </bpmn2:sequenceFlow>
      <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ServiceTask_1" targetRef="EndEvent_5"/>
    </bpmn2:subProcess>
    <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ParallelGateway_1" targetRef="SubProcess_1"/>
    <bpmn2:endEvent id="EndEvent_3">
      <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="SequenceFlow_7" sourceRef="SubProcess_1" targetRef="EndEvent_3"/>
    <bpmn2:endEvent id="EndEvent_4">
      <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
    </bpmn2:endEvent>
    <bpmn2:sequenceFlow id="SequenceFlow_1" sourceRef="preNormalEnd" targetRef="EndEvent_4"/>
  </bpmn2:process>
  <bpmndi:BPMNDiagram id="preNormalEndDiagram" name="Default Process Diagram">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="process_1">
      <bpmndi:BPMNShape id="BPMNShape_1" bpmnElement="start">
        <dc:Bounds height="36.0" width="36.0" x="89.0" y="448.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_ParallelGateway_1" bpmnElement="ParallelGateway_1">
        <dc:Bounds height="50.0" width="50.0" x="175.0" y="441.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="BPMNShape_1" targetElement="BPMNShape_ParallelGateway_1">
        <di:waypoint xsi:type="dc:Point" x="125.0" y="466.0"/>
        <di:waypoint xsi:type="dc:Point" x="175.0" y="466.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_UserTask_1" bpmnElement="preNormalEnd">
        <dc:Bounds height="50.0" width="110.0" x="254.0" y="518.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="BPMNShape_ParallelGateway_1" targetElement="BPMNShape_UserTask_1">
        <di:waypoint xsi:type="dc:Point" x="200.0" y="492.0"/>
        <di:waypoint xsi:type="dc:Point" x="200.0" y="542.0"/>
        <di:waypoint xsi:type="dc:Point" x="254.0" y="543.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_2" bpmnElement="EndEvent_1">
        <dc:Bounds height="36.0" width="36.0" x="839.0" y="310.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_SubProcess_1" bpmnElement="SubProcess_1" isExpanded="true">
        <dc:Bounds height="314.0" width="660.0" x="260.0" y="170.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="BPMNShape_ParallelGateway_1" targetElement="BPMNShape_SubProcess_1">
        <di:waypoint xsi:type="dc:Point" x="200.0" y="441.0"/>
        <di:waypoint xsi:type="dc:Point" x="200.0" y="345.0"/>
        <di:waypoint xsi:type="dc:Point" x="260.0" y="327.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_3" bpmnElement="EndEvent_3">
        <dc:Bounds height="36.0" width="36.0" x="1009.0" y="328.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="BPMNShape_SubProcess_1" targetElement="BPMNShape_EndEvent_3">
        <di:waypoint xsi:type="dc:Point" x="920.0" y="327.0"/>
        <di:waypoint xsi:type="dc:Point" x="1009.0" y="346.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_4" bpmnElement="EndEvent_4">
        <dc:Bounds height="36.0" width="36.0" x="414.0" y="525.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_UserTask_1" targetElement="BPMNShape_EndEvent_4">
        <di:waypoint xsi:type="dc:Point" x="364.0" y="543.0"/>
        <di:waypoint xsi:type="dc:Point" x="414.0" y="543.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="StartEvent_1">
        <dc:Bounds height="36.0" width="36.0" x="292.0" y="201.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_ServiceTask_1" bpmnElement="checkTerminate">
        <dc:Bounds height="50.0" width="110.0" x="378.0" y="194.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="BPMNShape_StartEvent_1" targetElement="BPMNShape_ServiceTask_1">
        <di:waypoint xsi:type="dc:Point" x="328.0" y="219.0"/>
        <di:waypoint xsi:type="dc:Point" x="378.0" y="219.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_ExclusiveGateway_1" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
        <dc:Bounds height="50.0" width="50.0" x="540.0" y="194.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="BPMNShape_ServiceTask_1" targetElement="BPMNShape_ExclusiveGateway_1">
        <di:waypoint xsi:type="dc:Point" x="488.0" y="219.0"/>
        <di:waypoint xsi:type="dc:Point" x="540.0" y="219.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_5" bpmnElement="EndEvent_5">
        <dc:Bounds height="36.0" width="36.0" x="800.0" y="201.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_ParallelGateway_2" bpmnElement="ParallelGateway_2">
        <dc:Bounds height="50.0" width="50.0" x="590.0" y="363.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="BPMNShape_ExclusiveGateway_1" targetElement="BPMNShape_ParallelGateway_2">
        <di:waypoint xsi:type="dc:Point" x="565.0" y="245.0"/>
        <di:waypoint xsi:type="dc:Point" x="565.0" y="393.0"/>
        <di:waypoint xsi:type="dc:Point" x="590.0" y="388.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_UserTask_3" bpmnElement="UserTask_1">
        <dc:Bounds height="50.0" width="110.0" x="691.0" y="414.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_2">
        <dc:Bounds height="36.0" width="36.0" x="839.0" y="421.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="BPMNShape_UserTask_3" targetElement="BPMNShape_EndEvent_1">
        <di:waypoint xsi:type="dc:Point" x="801.0" y="439.0"/>
        <di:waypoint xsi:type="dc:Point" x="839.0" y="439.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="BPMNShape_ParallelGateway_2" targetElement="BPMNShape_EndEvent_2">
        <di:waypoint xsi:type="dc:Point" x="615.0" y="363.0"/>
        <di:waypoint xsi:type="dc:Point" x="615.0" y="328.0"/>
        <di:waypoint xsi:type="dc:Point" x="839.0" y="328.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="BPMNShape_ParallelGateway_2" targetElement="BPMNShape_UserTask_3">
        <di:waypoint xsi:type="dc:Point" x="615.0" y="414.0"/>
        <di:waypoint xsi:type="dc:Point" x="612.0" y="438.0"/>
        <di:waypoint xsi:type="dc:Point" x="691.0" y="439.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="BPMNShape_ServiceTask_2" bpmnElement="ServiceTask_1">
        <dc:Bounds height="50.0" width="110.0" x="640.0" y="194.0"/>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="BPMNShape_ExclusiveGateway_1" targetElement="BPMNShape_ServiceTask_2">
        <di:waypoint xsi:type="dc:Point" x="591.0" y="219.0"/>
        <di:waypoint xsi:type="dc:Point" x="640.0" y="219.0"/>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="BPMNShape_ServiceTask_2" targetElement="BPMNShape_EndEvent_5">
        <di:waypoint xsi:type="dc:Point" x="750.0" y="219.0"/>
        <di:waypoint xsi:type="dc:Point" x="800.0" y="219.0"/>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn2:definitions>